import request from '@/utils/request/req';

/**
 * 获取人工介入列表
 * @param {Object} [data] - 请求参数
 * @param {string} [data.name] - 介入名称，可选，用于模糊搜索
 * @param {string} [data.type] - 介入场景，可选
 * @param {string} [data.status] - 状态，可选
 * @param {string} [data.keyword] - 关键词，可选
 * @param {number} [data.current] - 当前页码
 * @param {number} [data.size] - 每页条数
 * @returns {Promise<{code: number, msg: string, data: Array<{id: string, name: string, status: string, createBy: string, createTime: string, umWechatKeywords: string, type: string}>}>}
 */
export function getHumanInterventionList(data?: { name?: string; type?: string; status?: string; keyword?: string; current?: number; size?: number }) {
  return request({
    url: '/msg/humanIntervention/list',
    method: 'get',
    params: data
  });
}

/**
 * 添加人工介入
 * @param {Object} [data] - 请求参数
 * @param {string} data.name - 介入名称
 * @param {string} data.status - 状态
 * @param {string} data.createBy - 创建人
 * @param {string} data.keywords - 关键词 用,拼接
 * @param {string} data.type - 介入场景
 * @returns {Promise<{code: number, msg: string}>}
 */
export function addHumanIntervention(data?: { name: string; status: string; createBy: string; keywords: string; type: string }) {
  return request({
    url: '/msg/addHumanIntervention',
    method: 'post',
    data
  });
}

/**
 * 更新人工介入
 * @param {Object} [data] - 请求参数
 * @param {string} data.id - 介入ID
 * @param {string} data.name - 介入名称
 * @param {string} data.status - 状态
 * @param {string} data.keywords - 关键词 用,拼接
 * @param {string} data.type - 介入场景
 * @returns {Promise<{code: number, msg: string}>}
 */
export function updateHumanIntervention(data?: { id: string; name: string; status: string; keywords: string; type: string }) {
  return request({
    url: '/msg/updateHumanIntervention',
    method: 'post',
    data
  });
}

/**
 * 删除人工介入
 * @param {string} id - 介入ID
 * @returns {Promise<{code: number, msg: string}>}
 */
export function deleteHumanIntervention(id: string) {
  return request({
    url: `/msg/deleteHumanIntervention/${id}`,
    method: 'post'
  });
}
